#include "mainwindow.h"
#include "ui_mainwindow.h"
#include <QToolBar>
#include <QDialog>
#include <QDebug>
MainWindow::MainWindow(QWidget *parent)
    : QMainWindow(parent)
    , ui(new Ui::MainWindow)
{
    ui->setupUi(this);

    QToolBar* tb = new QToolBar(this);
    QAction* a = new QAction("打开");
    tb->addAction(a);

    connect(a,&QAction::triggered,[=](){
        QDialog* dialog = new QDialog(this);
        dialog->resize(300,400);
        dialog->setAttribute(Qt::WA_DeleteOnClose);
        dialog->setModal(true);
        dialog->show();
    });
}

MainWindow::~MainWindow()
{
    delete ui;
}


void MainWindow::on_pushButton_clicked()
{
    qDebug() << "按钮被按下";
}
